<?php
/* 
 * Copyright (c) 2018-2021   All rights reserved.
 * 
 * 创建时间：2021-05-15 13:10
 *
 * 项目：upload  -  $  - index.php
 *
 * 作者：liwei 
 */

!defined('INLEV') && exit('Access Denied LEV');

?>

<div class="page page-admin">
    <?php Lev::toolbarAdmin(); Lev::navbarAdmin($addurl, $srhtitle, $srhkey, 1, '', 0, 1); ?>

    <div class="page-content">
        <div class="card data-listb">
            <div class="data-xtable">
                <table><thead><tr>
                        <th class="checkbox-cell tab-center wd30">
                            <input type="checkbox" name="opids" onclick="checkedToggle(this,'input[name=\'ids[]\']')">
                        </th>
                        <th class="wd120">下单用户UID</th>
                        <th class="wd120">支付平台订单号</th>
                        <th class="wd100">支付类型</th>
                        <th class="wd120">商户号/APPID</th>
                        <th class="">支付者openid/ip</th>
                        <th class="wd100">商品名称</th>
                        <th class="numeric-cell wd100">支付金额</th>
                        <th class="tab-center wd60">订单状态</th>
                        <th class="tab-center wd60">状态</th>
                        <th class="numeric-cell wd60">加入时间</th>
                        <th class="wd60 tab-center">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php if (!empty($pages['lists'])):foreach ($pages['lists'] as $v):?>
                        <tr>
                            <td class="checkbox-cell tab-center"><input name="ids[]" type="checkbox" value="<?php echo $v['id']?>" title="<?php echo $v['id']?>" autocomplete="off"></td>
                            <td>
                                <a href="<?php echo Lev::toCurrent(['uid'=>$v['uid']])?>">
                                    <?php echo $v['uid'],'@<br>',Lev::arrv([$v['uid'], 'username'], $users, '#已丢失#')?>
                                </a>
                            </td>
                            <td><p class="scale9 transl"><?=$v['paysource'],$v['transaction_id']?></p>
                                <p class="scale9 transl"><?=$v['paymethod'],\modules\levpays\table\tradesHelper::getTradeno($v['id'])?></p>
                            </td>
                            <td>
                                <a href="<?php echo Lev::toCurrent(['paytypeid'=>$v['paytypeid']])?>"><?=Lev::arrv($v['paytypeid'], $paytypeids)?></a>
                            </td>
                            <td><?=$v['mchid']?>
                                <p class="scale9 transl"><?=$v['appid']?></p>
                            </td>
                            <td>
                                <p class="scale9 transl"><?=$v['openid']?></p>
                                <p class="scale9 transl"><?=$v['ip']?></p>
                            </td>
                            <td>
                                <p class="scale8 transl inblk"><?=$v['iden']?></p><?=$v['name']?>
                                <p class="scale8 transl"><?=$v['descs']?></p>
                            </td>
                            <td class="numeric-cell"><b class="color-red"><?=$v['paymoney']?></b>
                            </td>
                            <td class="tab-center">
                                <a class="color-gray scale9 inblk" href="<?php echo Lev::toCurrent(['tradestatus'=>$v['tradestatus']])?>">
                                <?=Lev::arrv($v['tradestatus'], $tradestatuses)?>
                                </a>
                            </td>
                            <td class="tab-center">
                                <label class="label-switch scale8 color-green setStatus" opid="<?php echo $v['id']?>">
                                    <input type="checkbox" <?=$v['status']?'':'checked'?>>
                                    <div class="checkbox"></div>
                                </label>
                            </td>
                            <td class="numeric-cell">
                                <p class="date transr" title="支付成功时间"><?php echo Lev::asRealTime($v['paytime'], '从未')?></p>
                                <p class="date transr" title="加入时间"><?php echo Lev::asRealTime($v['addtime'], '从未')?></p>
                            </td>
                            <td class="tab-center">
                                <a class="checkedTradeAdmin" href="<?=Lev::toCurrent(['opid'=>$v['id'], 'r'=>'admin-trades/check'])?>"><absx>支付核查</absx></a>
                            </td>
                        </tr>
                    <?php endforeach; else:?>
                        <tr><td colspan="100" class="tab-center">
                                <tips><?php echo $srhkey?'没有搜索到【'.$srhkey.'】相关数据':'没有数据'?></tips>
                            </td>
                        </tr>
                    <?php endif;?>
                    </tbody>
                </table>
                <div class="card-footer">
                    <tips></tips>
                    <?php echo $pages['pages']?>
                </div>
            </div>
        </div>
    </div>

</div>

<script>
(function () {
    'use strict';

    jQuery(function () {
        Levme.onClick('.checkedTradeAdmin', function () {
            showIconLoader(true);
            Levme.ajaxv.postv(jQuery(this).attr('href'), function (data, status) {
                hideIconLoader();
                status <0 &&
                data && data.message && levtoast(data.message, 100000);
            });
            return false;
        });
    });

})();
</script>